﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection.Emit;
using System.Text;
using System.Threading.Tasks;

namespace Win32AddIn
{
  class Program
  {
    static void Main(string[] args)
    {
      IntPtr hwndCalc = new IntPtr(0x004506b6); // 窗体句柄

      List<IntPtr> list = new List<IntPtr>();
      WinAPIuser32.CallFuntion = delegate (IntPtr enumIntPtr)
      {
        StringBuilder s = new StringBuilder(2000);
        WinAPIuser32.GetClassName(enumIntPtr, s, 255);
        if (s.ToString() == "GXEDIT")
        {
          list.Add(enumIntPtr);
        }
      };
      WinAPIuser32.EnumChildWindows(hwndCalc, 0);
      WinAPIuser32.CallFuntion = null;
//第1个文本框
      WinAPIuser32.SendTextMessage(list[2], MSCODE.WM_SETTEXT, 0, "111");
//第2个文本框
      WinAPIuser32.SendTextMessage(list[1], MSCODE.WM_SETTEXT, 0, "111");
//第3个文本框
      WinAPIuser32.SendTextMessage(list[0], MSCODE.WM_SETTEXT, 0, "111");
    }
  }
}
